import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/components/video/ijk_player.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/core/ext/widget_extension.dart';
import 'package:enterprise_v6_app/app/core/utils/interface.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/live/live_player_view_controller.dart';

class LivePlayer extends StatefulWidget {
  const LivePlayer({super.key});

  @override
  State<LivePlayer> createState() => _LivePlayerState();
}

class _LivePlayerState extends State<LivePlayer> {
  final controller = Get.put(LivePlayerController());

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar(
        titleText: '直播',
      ),
      body: Stack(
        children: [
          const Column(
            children: [],
          ),
            Container(
              height: 300,
              width: MediaQuery.of(context).size.width,
              alignment: Alignment.center,
              child: IjkPlayerPage(
                url: '${Interface.pullUrl}${controller.ticketPlanReceiptLists.id}.live.flv',
              ),
            ),
          Positioned(
            bottom: 0,
            child: Container(
              width: MediaQuery.of(context).size.width,
              height: 100,
              color: Colors.white,
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: [
                  Container(
                    padding: const EdgeInsets.only(top: 10, right: 20, left: 20, bottom: 10),
                    decoration: BoxDecoration(border: Border.all(color: AppColors.font_color_blue, width: 1), borderRadius: BorderRadius.circular(24)),
                    child: const Text(
                      '作业中断',
                      style: TextStyle(
                        fontSize: 16,
                        color: AppColors.font_color_blue,
                      ),
                    ),
                  ).click(controller.interruptHomework),
                  Container(
                    padding: const EdgeInsets.only(
                      top: 10,
                      right: 20,
                      left: 20,
                      bottom: 10,
                    ),
                    decoration: BoxDecoration(
                        border: Border.all(
                          color: AppColors.font_color_blue,
                          width: 1,
                        ),
                        borderRadius: BorderRadius.circular(24)),
                    child: const Text(
                      '中止作业',
                      style: TextStyle(
                        fontSize: 16,
                        color: AppColors.font_color_blue,
                      ),
                    ),
                  ).click(controller.stopHomework),
                  Container(
                    padding: const EdgeInsets.only(top: 11, right: 20, left: 20, bottom: 11),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(24),
                      color: AppColors.font_color_blue,
                    ),
                    child: const Text(
                      '作业验收',
                      style: TextStyle(
                        fontSize: 16,
                        color: Colors.white,
                      ),
                    ),
                  ).click(controller.acceptHomework),
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}
